Currently, digital cameras are widely used to take photographs. As known, the definition of the object taken by a digital camera is largely effected by the focusing operation of the digital camera. In order to achieve high image quality of the object, the focal length should be properly adjusted to focus on the object. In other words, the quality of the digital camera is dependent on the auto focus method applied to the digital camera.
Generally, auto focus methods are classified into two types, i.e. an active auto focus method and a passive auto focus method.
For implementing the active auto focus method, light patterns are projected onto the object to be photographed by using an infrared emitter or a laser emitter, and then the distance between the object and the camera is calculated by triangulation or according to the time difference from the beam projection to reception. Afterwards, the lens of the digital camera is adjusted to a proper position according to the distance. However, this active auto focus method has several drawbacks. For example, the cost of the digital camera is increased because extra detector and beam projector are needed.
The steps for implementing the passive auto focus method are illustrated with reference of the flowchart of FIG. 1. Unlike the active auto method, the passive auto focus method determines the distance between the object and the camera without projecting any light pattern onto the object. Afterwards, the lens of the digital camera is moved to multiple possible positions and the image qualities at different positions are analyzed in order to determine an accurate lens position. Firstly, the lens of the camera is moved to a first position and the image data at this position is captured (Step 100). Then, the focus value of the image is calculated (Step 200). If this focus value is the maximum focus value (Step 300), the auto focus (AF) process is finished. Otherwise, the lens is moved to the next position (Step 400), and the steps 200, 300 and 400 are repeated until the maximum focus value is searched.
From the flowchart of FIG. 1, the passive auto focus method includes two parts, i.e. the focus value measurement and the lens position search algorithm.
Conventionally, there are several means for implementing focus value measurements such as gradient magnitude measurement, Robert edge detector, Sobel edge detector, Laplacian filter, infinite impulse response (IIR) filter, etc. These focus value measurements are well known to those skilled in the art, and are not intended to describe redundantly herein.
The conventional lens position search algorithms include for example global search algorithm, hill-climbing search algorithm, binary search algorithm and ruled-based search algorithm.
Typically, search time, number of the lens movement steps and search accuracy are all very important for the lens position search algorithm. Generally, longer search time means lower auto focus efficiency, and more lens movement steps consume more power of the camera because each movement step needs power. Whereas, too short search time or insufficient movement steps are detrimental to the searching accuracy. These lens position search algorithms have respective advantages or drawbacks. Consequently, the designer may select one of these lens position search algorithms according to the practical requirement.
For example, since the global search algorithm captures image in every lens movement step and determines the position with the maximum focus value, the search result of the global search algorithm is the most correct among these lens position search algorithms. However, the global search algorithm needs too long search time and too many lens movement steps. In addition, the binary search algorithm is faster than global search algorithm but is more prone to be affected by noise. Moreover, the lens needs to move back and forth to obtain the peak position, which might suffer from mechanical backlash problem.
The ruled-based search algorithm determines the search steps for each lens movement step according to certain rules and then records the focus value of the lens at each position. Since the rules allow the assembler to capture acceptable image data of the lens without measuring the focus value for each lens movement step, the search time for implementing the ruled-based search algorithm is shortened. The search rules are shown as follows.
IF CIteration ≦ 5 THEN AControl = InitialELSEIF FCurrent ≦ 0.25·FMax, THEN AControl = Coarse;CDown = 0;ELSEDF = FCurrent − FPreviousIF DF > 0.25·FPrevious, THEN AControl = Fine;CDown = 0;ELSE IF AControl = Fine AND DF > 0, THENCDown = 0;ELSE IF DF < 0IF AControl = Fine, THEN CDown + +;IF CDown = 3, THEN AControl = Mid; CDown = 0;ELSEAControl = Mid; CDown = 0;END IFEND IFEND IFUPDATE FMax;FPrevious = FCurrent;
In the above rules, FCurrent is sharpness value from current image data, FPrevious is sharpness value from previous image data, FMax is maximum sharpness value, CIteration is iteration counter, AContro: is control area, and CDown is downhill counter.
In views of the above-described disadvantages resulted from the prior art, the applicant keeps on carving unflaggingly to develop an auto focus method for use with a digital camera according to the present invention through wholehearted experience and research.